package com.mingdong.first.factory.absFactory;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import com.mingdong.first.factory.pizza.Pizza;

public class OrderPizza {

	AbStractFactory abStractFactory;
	
	public OrderPizza(AbStractFactory abStractFactory){
		
		do {
			String type = getType();
			Pizza pizza = abStractFactory.createPizza(type);
			if(pizza != null){
				pizza.prepare();
				pizza.cook();
				pizza.cut();
				pizza.box();
			}
		} while (true);
		
	}
	
	
	public String getType(){
		
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String type = reader.readLine();
			return type;
		} catch (Exception e) {
			// TODO: handle exception
			return "";
		}
		
		
		
	}
}
